﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;

namespace visualizadordicom.Aux_Forms
{
    public partial class brightprofile : Form
    {
        /// <summary>
        /// This function will create a bright profile.
        /// </summary>
        /// <param name="profile">
        /// It contains the bright profile data
        /// </param>
        /// <param name="pos">
        /// It is the position of the first pixel in the vector.
        /// </param>
        public brightprofile(double[] profile, int pos)
        {
            InitializeComponent();
            GraphPane pane = zedGraphControl1.GraphPane;

            pane.Title.Text = "Perfil de valores de pixel";
            pane.XAxis.Title.Text = "Posição";
            pane.YAxis.Title.Text = "Valor";


            //Creates a second array (x) with the position information in the range.
            double[] array = new double[profile.Length];
            for (int i = 0; i < profile.Length; i++)
            {
                array[i] = (double)(i + pos);
            }

            LineItem myCurve = pane.AddCurve("Perfil da Região selecionada", array, profile, Color.Red);

            myCurve.Line.Fill = new Fill(Color.Red);
            zedGraphControl1.AxisChange();
        }


        /// <summary>
        /// Close the form.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
